When a well becomes less productive, and all attempts to improve the production of hydrocarbons from a reservoir have failed, the unproductive part of the well, if not the whole well, is plugged and abandoned. In some cased wells, the well has parts where the casing or production tubing is surrounded by an annulus which has not been filled with cement during completion. Such cased wells may also have an annular space between the intermediate casing and the production casing in the upper part of the well. In such wells with annulus or annular spaces, the plug and abandonment becomes complicated, since when the casing is filled with cement to plug the well, the cement cannot fill out the annular space or the annulus and there is a risk of a blowout through that annulus or annular space. In order to properly plug the well, a large rig is shipped to the well to pull the production casing out of the well. Such operation is thus, in the known solution, necessary and expensive.